package com.zhiyou100.poly2;

import jdk.nashorn.internal.ir.annotations.Ignore;

public class Test2 {

    public static void main(String[] args) {

        //向下转型（强制完成）   需要保证父类类型的引用变量本身指向的就是子类类型的对象
        Bird bird = new Ostrich();
        //类型检测   判断当前引用变量是否属于某个类型
        if (bird instanceof Ostrich){
            Ostrich ostrich =(Ostrich) bird;
        }

        bird = new Pigeon();
        if (bird instanceof Pigeon) {
            Pigeon pigeon = (Pigeon) bird;
        }
    }
}
